import request from '@/axios'
import type { AppVersionForm, AppVersionTableView } from './types'

const pathPrefix = '/api/app/version'

export const query = (data: PaginationRequest): Promise<PaginationResponse<AppVersionTableView>> => {
    return request.post({
        url: `${pathPrefix}/query`,
        data
    })
}

export const release = (appId: string, data: AppVersionForm): Promise<ApiResult> => {
    return request.post({
        url: `${pathPrefix}/${appId}/release`,
        data
    })
}

export const remove = (id: string): Promise<ApiResult> => {
    return request.delete({
        url: `${pathPrefix}/${id}`
    })
}


export const upgradeModeOptions = (): Promise<OptionItem[]> => {
    return request.get({
        url: `${pathPrefix}/upgrade-mode/options`
    })
}